home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group97a.txt
/
000090_icon-group-sender _Sat Mar 22 17:31:59 1997.msg
< prev
next >
Wrap
Internet Message Format
|
2000-09-20
|
2KB
Received: by cheltenham.cs.arizona.edu; Sat, 22 Mar 1997 16:11:52 MST
To: icon-group@cs.arizona.edu
Date: Sat, 22 Mar 1997 17:31:59 +1000
From: Stuart Robinson <Stuart.Robinson@anu.edu.au>
Message-Id: <33338AEF.420@anu.edu.au>
Sender: icon-group-request@cs.arizona.edu
Subject: Problem with Program
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1091
Hello.
I've run into a problem with a program that I've written and I was
hoping that someone would tell what is wrong. I'm sure it's silly and
stupid but I am a newcomer to programming in general and Icon in
particular.
This short little program is meant to read a line and write either (1)
a tab followed by the line or (2) simply the line. It should do (1)
if the line either contains "{Q" or follows a line with "{Q";
otherwise, it should do (2).
I would greatly appreciate it if someone could tell me I have slipped
up. Also, if anyone knows of an alternative strategy, I would
appreciate hearing about it. Thanks. (The program follows.)
======================================================================
procedure main()
lastline := ""
while line := read() do
{
line ?
{
if find( "{Q" )
then
presentline := "quote"
write( "\t" || line );
else
if lastline == "quote"
then
write( "\t" || line )
presentline := "notquote";
else other
write( line )
presentline := "notquote"
}
}
lastline := presentline
end